<!--
 * @Descripttion: 模具故障报修
 * @LastEditors: xzh
 * @LastEditTime: 2023-08-27 22:22:10
-->
<template>
  <div class="dile-rootForm" v-loading="loading">
    <!-- 设备维修表单 -->
    <div class="dile-rootForm-content">
      <RepairRecordForm ref="repairRecordFormRef" />
    </div>
    <div class="dile-rootForm-footTool">
      <el-button type="success" @click="handleSave">{{
        $t("common.define")
      }}</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive } from "vue";
import RepairRecordForm from "../repairRecord/repairRecord-form/index.vue";
import Dile_StoreAction from "@/utils/cache/store";

let loading = ref<boolean>(false);
/**
 * @Author: xzh
 * @Descripttion: 设备维修表单实例
 * @Param:
 */
let repairRecordFormRef = ref<any>(null);
/**
 * @Author: xzh
 * @Descripttion: 保存事件
 * @Param:
 */
let handleSave = async () => {
  if (!!loading.value) {
    return false;
  }
  try {
    loading.value = true;
    //保存表单数据
    if ((await repairRecordFormRef.value.hanldeSaveForm()) == false) {
      return false;
    }
    //跳转路由
    Dile_StoreAction.toggleRouter({
      props: {
        name: "moldRepairRecord",
      },
    });
  } finally {
    loading.value = false;
  }
};
</script>
<style lang="scss" scoped></style>
